package com.wq.redpacket.service;

import com.wq.api.repository.redpacket.RedPacketAccountRepository;
import com.wq.api.service.redpacket.RedPacketAccountService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * Created by twinkle.zhou on 16/11/11.
 */
@Service("redPacketAccountService")
@DubboService
public class RedPacketAccountServiceImpl implements RedPacketAccountService {

    @DubboReference
    RedPacketAccountRepository redPacketAccountRepository;

    @Override
    public BigDecimal getRedPacketAccountByUserId(long userId) {
        return redPacketAccountRepository.findByUserId(userId).getBalanceAmount();
    }
}
